import unittest
import unittestreport
import time


if __name__ == '__main__':
    suit = unittest.TestLoader().discover(R'C:\TT\习知\12\my_test_demo_12\unittestDemo\case1', "test*.py")
    runner = unittestreport.TestRunner(
        suite=suit,     # 测试套件
        tester='坚果',    # 测试人员
        filename='report-坚果.html',  # 生成的报告文件名字
        report_dir=r'.\reports',   # 生成报告的目录
        title='报告标题-坚果',           # 报告标题
        desc='报告描述-坚果',            # 报告描述
        templates=2                 # 报告风格
    )
    start_time = time.time()
    runner.run(count=2, interval=2, thread_count=5)
    end_time = time.time()
    print("用例运行耗时：",end_time-start_time)
















# from test_demo01 import *
# import test_demo01, test_demo02

# if __name__ == '__main__':
#     # 创建测试套件
#     suit = unittest.TestSuite()
#     # 创建加载器
#     loader = unittest.TestLoader()
#     # 测试套件中添加测试用例类
#     # suit.addTests([loader.loadTestsFromTestCase(Test), loader.loadTestsFromTestCase(TestA)])
#     suit.addTests([loader.loadTestsFromModule(test_demo01), loader.loadTestsFromModule(test_demo02)])
#
#     # 运行测试用例,verbosity=2(为每个测试用例输出报告),这时候run运行的是测试套件
#     unittest.TextTestRunner(verbosity=2).run(suit)